package org.springblade.core.mp.support;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

public class Condition {
    public Condition() {
    }

    private static Long toInt(Integer v, int defaultValue) {
        if (v != null) {
            return Long.valueOf(v);
        }
        return Long.valueOf(defaultValue);
    }

    public static <T> IPage<T> getPage(Query query) {
        Page<T> page = new Page(toInt(query.getCurrent(), 1), toInt(query.getSize(), 10));

        return page;
    }
}
